package com.leoman.service;

import com.leoman.entity.AppUser;
import com.leoman.entity.CompanyUser;
import com.leoman.entity.UserResume;
import com.leoman.entity.vo.StatUserData;
import com.leoman.entity.vo.VideoResumeVo;
import com.leoman.exception.*;
import com.leoman.service.common.ICommonService;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartRequest;

/**
 * AppUserService
 * Created by 涂奕恒 on 2016/10/18.
 */
public interface AppUserService extends ICommonService<AppUser> {

    // 发送验证码
    String sendCode(String mobile, Integer type, Integer isCompany) throws ParamErrorException, MobileExistException, MobileNotFindException;

    // 用户注册
    void iRegister(String mobile, String password, String code, Integer isCompany) throws ParamErrorException, MobileExistException, CodeErrorException;

    // 普通用户登录
    AppUser iAppUserLogin(String mobile, String password) throws ParamErrorException, MobileNotFindException, PasswordErrorException, UserSealStatusException;

    // 企业用户登录
    CompanyUser iCompanyUserLogin(String mobile, String password) throws ParamErrorException, MobileNotFindException, PasswordErrorException, UserSealStatusException;

    // 检测验证码是否正确
    Integer checkCode(String mobile, String code, Integer type, Integer isCompany);

    // 第三方用户登录
    AppUser iLoginPlus(String openId,
                       Integer type,
                       String avatar,
                       String nickName) throws ParamErrorException, ThirdTypeErrorException, UserSealStatusException;

    // 忘记密码
    void iForgetPwd(String mobile,
                    String password,
                    String code,
                    Integer isCompany) throws ParamErrorException, MobileNotFindException, CodeErrorException, UserSealStatusException;

    // 绑定手机号
    void iBindingMobile(Integer userId,
                        String mobile,
                        String password,
                        String code,
                        Integer isCompany)
            throws ParamErrorException,
            UserNotFindException,
            MobileExistException,
            CodeErrorException,
            UserSealStatusException;

    // 查询用户详情
    AppUser iFindOneByInfo(Integer userId) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 查询用户简历详情
    UserResume iFindOneByResumeInfo(Integer userId) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 修改用户信息
    void iModifyAppUserInfo(Integer userId,
                            String nickName,
                            Integer sex,
                            Integer age,
                            Integer regionId,
                            String email) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 修改用户密码
    void iModifyAppUserPassword(Integer userId,
                                String oldPassword,
                                String newPassword)
            throws ParamErrorException,
            OldPasswordErrorException,
            UserNotFindException,
            UserSealStatusException;

    // 修改用户支付宝信息
    void iModifyAppUserAliPayInfo(Integer userId,
                                  String aliPayName,
                                  String aliPayAccount)
            throws ParamErrorException,
            UserNotFindException,
            AliPayInfoExistException,
            UserSealStatusException;

    // 修改用户头像
    void iModifyAppUserAvatar(Integer userId, MultipartRequest multipartRequest)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException;

    // 用户申请提现
    void iApplyMoney(Integer userId, Double money)
            throws ParamErrorException,
            UserNotFindException,
            AliPayInfoNotFindException,
            MoneyShortException,
            UserSealStatusException;

    // 修改用户简历信息
    void iModifyResumeInfo(Integer userId,
                           String userName,
                           Integer age,
                           String mobile,
                           String email,
                           Integer regionId,
                           Integer cityId,
                           String nationInfo,
                           String schoolName,
                           String educationInfo,
                           String disciplineInfo,
                           String situationInfo,
                           String honorInfo,
                           String skillInfo) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 用户投递简历
    void iSendResume(Integer userId, Integer videoRecordId)
            throws ParamErrorException,
            UserNotFindException,
            VideoNotFindException,
            SendResumeExistException,
            ResumeNotFindException,
            UserSealStatusException;

    // 用户简历投递记录（分页）
    Page<VideoResumeVo> iPageVideoResumeForApp(Integer userId, Integer pageNum, Integer pageSize)
            throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 用户添加意见反馈
    void iAddFeedBack(Integer userId,
                      String mobile,
                      String content,
                      Integer isCompany) throws ParamErrorException, UserNotFindException, MobileNotFindException, UserSealStatusException;

    // 修改用户简历证书
    void iModifyResumeImg(Integer userId,
                          String deleteIds,
                          Integer imgNum,
                          MultipartRequest multipartRequest)
            throws ParamErrorException, UserNotFindException, UserSealStatusException, ResumeNotFindException;

    // 修改用户简历头像
    void iModifyResumeAvatar(Integer userId,
                             MultipartRequest multipartRequest)
            throws ParamErrorException, UserNotFindException, UserSealStatusException, ResumeNotFindException;

    // *
    // *
    // *
    // * 上面的是移动端接口
    // *
    // * 我是分割线
    // *
    // * 下面的是后台的方法
    // *
    // *
    // *

    // 查询新增普通用户数
    Integer findCountWithNewAppUser(Integer index);

    // 查询新增普通用户提现申请数
    Integer findNewAppUserGainCount(Integer index);

    // 查询普通用户列表（分页）
    Page<AppUser> pageByParams(String mobile,
                               String nickName,
                               Integer sex,
                               Integer status,
                               Integer provinceId,
                               Integer cityId,
                               Integer pageNum,
                               Integer pageSize);

    // 批量修改普通用户状态
    Integer changeAppUserStatus(Integer[] appUserId, Integer status);

    // 统计用户分布
    StatUserData getStatUserData(Integer companyUserId);
}